package com.hh.admin.controller;

import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.hh.admin.entity.SysMenu;
import com.hh.admin.service.ISysMenuService;
import com.hh.admin.view.AdminView;
import com.hh.core.common.BaseController;
import com.hh.core.shiro.util.ShiroUtil;

/**
 * @author xn-h
 * @describe(admin 后台管理页面 控制层)
 * @create 2018/1/21
 **/
@Controller
@RequestMapping(value = "/admin")
public class AdminController extends BaseController{

//	private static final Log log = LogFactory.get();

	@Autowired
	ISysMenuService sysMenuService;

	@RequestMapping(value = "",method = RequestMethod.GET)
	public String adminIndex(Model model){
		//获取用户的角色集合
		Set<Long> roleList = ShiroUtil.getUser().getRoleList();
		List<SysMenu> menuList = sysMenuService.getMenuNavByRoleid(roleList);
		model.addAttribute("menuList", menuList);
		return AdminView.ADMIN_INDEX;
	}
}
